<template>
	<view class="qrcode" id="qrcode">
		<view class="baseInfo">
			<view class="baseTitle">基础信息</view>
			<div class="baseTable">
				<div class="name">施工标段</div>
				<div class="info">{{formData.fCompanyname}}</div>
			</div>
			<div class="baseTable">
				<div class="name">施工单位</div>
				<div class="info">{{formData.fCompanyname}}</div>
			</div>
			<div class="baseTable">
				<div class="name">监理单位</div>
				<div class="info">{{formData.fJlname}}</div>
			</div>
			<div class="baseTable">
				<div class="name">编号</div>
				<div class="info">{{formData.fNumber}}</div>
			</div>
			<div class="baseTable">
				<div class="name">工程名称</div>
				<div class="info">{{formData.fProjectname}}</div>
			</div>
			<div class="baseTable">
				<div class="name">检测项目</div>
				<div class="info">{{formData.fCheckcontent}}</div>
			</div>
			<div class="baseTable">
				<div class="name">检测日期</div>
				<div class="info">{{formData.fCheckdates}}</div>
			</div>
			<div class="baseTable">
				<div class="name">检测设备</div>
				<div class="info">{{formData.fCompanyname}}</div>
			</div>
		</view>
		<view class="testResult">
			<view class="baseTitle">检测结果</view>
			<view class="table">
				<zb-table :columns="table_config" :stripe="true" @rowClick="rowClick" :border="true" :data="tableData">
				</zb-table>
			</view>
		</view>
	</view>
</template>

<script>
	import zbTable from '@/components/common/zb-table/components/zb-table/zb-table.vue'
	export default {
		data() {
			return {
				table_config: [{
						type: 'index',
						width: 60,
						label: '序号',
						align: 'center',
					},
					{
						name: 'fLength',
						label: '桩长(m)',
						align: 'center',
                        width: 75,
						emptyString: '--'
					},
					{
						name: 'fDiameter',
						label: '桩径(m)',
						align: 'center',
						 width: 75,
					},
					// {
					// 	name: 'sex',
					// 	label: '性别',
					// 	filters: {
					// 		0: '男',
					// 		1: '女'
					// 	}
					// },
					{
						name: 'fStrengthgrade',
						label: '强度等级',
						align: 'center',
						width: 80,
					},
					{
						name: 'fPiercategory',
						label: '桩类别',
						align: 'center',
						width: 80,
					},

				],
				tableData: [],
				formData: {},

			}
		},
		components: {
			zbTable
		},
		onLoad(option) {
			this.getDetailData({
				fId: window.location.href.split("=")[1]
			})






		},
		methods: {
			rowClick(row, index) {
				uni.showToast({
					icon: 'none',
					duration: 3000,
					title: '单击某行'
				})
				console.log('单击某行', row, index)
			},
			// 详情
			getDetailData(data) {

				var that = this;
				// that.fileList = [];

				that.$http.getPierTaskByFid(data).then(res => {
					if (res.errcode == 0) {
						console.log(res);
						this.formData = res.data.lrCheckPiertask;
						this.tableData = res.data.lrCheckPiertask.pierfoundationList;
						// let fileUrl = encodeURIComponent(res.data.url) // encodeURIComponent 函数可把字符串作为 URI 组件进行编码。
						// this.pdfUrl = this.viewerUrl + '?file=' + fileUrl
						// this.pdfUrl = this.viewerUrl + '?file=' + fileUrl

					} else {
						uni.showToast({
							title: "请求失败",
							icon: 'none',
							duration: 2000
						});
					}

				}, (err) => {
					uni.showToast({
						title: "接口报错",
						icon: 'none',
						duration: 2000
					});
				})

			},
			downloadPdfClick() {
				// 下载情景1:h5内嵌app,通过分享给朋友的方式进行下载
				if (this.from == 'app') {
					let item = 'http://自己的域名/hybrid/html/web/pdf.html?shareUrl=' + encodeURIComponent(this.bgUrl) +
						'&shareTitle=PDF文件';
					window.open(item);
					return;

				} else if (this.from == 'wx wq') {
					// 下载情景2:h5内嵌微信小程序,从h5页面跳转到小程序页面后,然后通过调用小程序原生API进行下载
					// 注意: 先要引入微信jssdk  [命令: npm install jweixin-module]
					// this.$wx.miniProgram.navigateTo({
					// 	url: '/pages/pdf/pdf_download?pdf='+ encodeURIComponent(this.bgUrl) //小程序页面链接
					// });
				}

			}
		}
	}
</script>

<style scoped lang="less">
	.baseInfo {
		background-color: #fff;
	}

	.testResult {
		margin-top: 15upx;
		background-color: #fff;
	}

	.baseTitle {
		border-bottom: 1px solid #0c204d;
		height: 30px;
		line-height: 30px;
		position: relative;
		padding-left: 15px;
	}

	.baseTable {
		display: flex;
		height: 70upx;
		line-height: 70upx;
		padding: 0 30upx;
		font-size: 28upx;
		border-bottom: 1px solid #eee;

		.name {
			width: 150upx;
		}

		.info {
			flex: 1;
		}
	}

	.baseTitle::after {
		display: block;
		content: "";
		height: 30px;
		width: 5px;
		position: absolute;
		left: 0;
		top: 0;
		background: #0c204d;
	}
</style>
